@()(implicit session: Session)
@config.main("Publications") {

  <style>
    p{
      margin-bottom: 0;
    text-align: center
    }
  </style>

  <div class="body-box">
    <div class="page-box">

      @config.subTitle("Publications")

      <div class="main-body">
        <table class="table table-hover" id="table" data-pagination="true" data-advanced-sortable="true"
        data-page-list="[10]">
          <thead>
            <tr >
              <th data-field="id"   data-formatter="GetDownload">  Download</th>
              <th data-field="title" data-searchtype="text" data-sortable="true" data-formatter="GetOpen">Title</th>
              <th data-field="year" data-searchtype="text" data-sortable="true">Year</th>
              <th data-field="author" data-searchtype="text" data-sortable="true">Author</th>
              <th data-field="journal" data-searchtype="text" data-sortable="true">Journal</th>
            </tr>
          </thead>
        </table>
      </div>
    </div>
  </div>

  <script>

    $(function (){
      $.post("@routes.PublicationsController.getAllPublications",(data)=>{
        $("#table").bootstrapTable({
          data:data
        })
      })
    })

    function GetOpen(value,row){
      return `<p><a href='/COADB/publiction/openPdf?file=${row.id}' target='_blank'>${value}</a></p>`;
    }



    function GetDownload(value,row){
      return `<p><a href='/COADB/publiction/downloadPdf?file=${row.id}' target='_blank'><i class='fa fa-download'></i></a></p>`;
    }


  </script>
}